import SwiftUI
import WebKit

/*
 * 分割布局示例
 */
class WebViewExample: FCUIView{
    /*
     * 初始化布局
     */
    override func onLoad(){
        let isInit = super.m_isInit;
        super.onLoad();
        if !isInit{
            m_paint.defaultUIStyle = "dark"
            let width = Double(self.frame.size.width), height = Double(self.frame.size.height)
            renderFaceCat(name:"webviewexample", paint: m_paint, size: FCSize(cx:width, cy:height))
            let webView = WKWebView()
            addSubview(webView)
            webView.frame = CGRect(x: 0, y: self.frame.size.height / 3, width: self.frame.size.width, height: self.frame.size.height * 2 / 3)
            let filePath = Bundle.main.path(forResource: "page", ofType: "html")
            let url = URL.init(fileURLWithPath: filePath!)
            webView.loadFileURL(url, allowingReadAccessTo: url)
        }
    }
}
